FROM python:3.12-slim

# 安装系统依赖和Intel运行时库
RUN apt-get update && apt-get install -y \
    gcc \
    gfortran \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /server

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY ./app ./app

ENV PYTHONPATH=/server
ENV LD_LIBRARY_PATH="/usr/local/lib/python3.12/site-packages/intel_fortran_rt/lib:/usr/local/lib:$LD_LIBRARY_PATH"

EXPOSE 8000

CMD ["fastapi", "run", "--workers", "4", "app/main.py"]